#include "deal.h"
#include "mdebug.h"
int loginDeal(sqlite3 *dbEntry, Mesg *message)
{
	int rtn = user_compare(dbEntry, message->work_num, message->passwd, &(message->type));
	if (rtn > 0)
	{
		message->ack = rtn;
		return 0;
	}
	return rtn;
}
int registerDeal(sqlite3 *dbEntry, Mesg *message)
{
	return inset_user(dbEntry,message);
}
int catUserInfoDeal(sqlite3 *dbEntry, Mesg *message)
{
	int rtn = select_userinfo(dbEntry, message);
	if (rtn == LOGIN_NOUSER)
	{
		message->ack = rtn;
		return 0; 
	}
	return rtn;
}
int updatePasswdDeal(sqlite3 *dbEntry, Mesg *message)
{
	return passwd_update(dbEntry, message->work_num, message->passwd);
}
int updateUserInfoDeal(sqlite3 *dbEntry, Mesg *message)
{
	int rtn = 0;
	rtn = info_update(dbEntry, message);
	if (rtn == LOGIN_NOUSER)
	{
		message->ack = LOGIN_NOUSER;
		return 0;
	}
	return rtn;
}
int deleteUserDeal(sqlite3 *dbEntry, Mesg *message)
{
	return delete_user(dbEntry, message->work_num);
}

